#include "GUI_Textarea.h"

static lv_color_t lv_color_cursor(const lv_color_filter_dsc_t * dsc,lv_color_t c,lv_opa_t lvl){
    LV_UNUSED(dsc);
    return GUI_THEME_FONT_COLOR01;
}

lv_obj_t * GUI_TextArea_Create(lv_obj_t * father){
    static lv_style_t cursor_style;
    lv_style_init(&cursor_style);
    lv_style_set_bg_color(&cursor_style, lv_palette_main(LV_PALETTE_RED));

    lv_obj_t * textarea = lv_textarea_create(father);
    lv_obj_set_style_pad_all(textarea,5,LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(textarea,10,LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(textarea,GUI_THEME_BG_COLOR01,LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(textarea,GUI_THEME_SHADOW_COLOR01,LV_STATE_DEFAULT);
    lv_obj_set_style_height(textarea,GUI_INPUTTEXT_HEIGHT,LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(textarea,GUI_THEME_FONT_COLOR01,LV_STATE_DEFAULT);

    static lv_color_filter_dsc_t color_filter;
    lv_color_filter_dsc_init(&color_filter,lv_color_cursor);
    lv_obj_set_style_color_filter_dsc(textarea,&color_filter,LV_PART_CURSOR);
    lv_obj_set_style_color_filter_opa(textarea,LV_OPA_20,LV_PART_CURSOR);

    return textarea;
}
